<% @page_title = "Create Kubernetes Cluster"
@has_valid_payment_method = @project.has_valid_payment_method?
@option_tree, @option_parents = generate_kubernetes_cluster_options %>

<%== render("components/billing_warning") %>

<%== part(
  "components/page_header",
  breadcrumbs: [
    %w[Projects /project],
    [@project.name, @project.path],
    ["Kubernetes Clusters", "#{@project.path}/kubernetes-cluster"],
    %w[Create #]
  ]
) %>

<%
  form_elements = [
    {name: "name", type: "text", label: "Cluster Name", required: "required", placeholder: "Enter cluster name"},
    {name: "location", type: "radio_small_cards", label: "Location", required: "required", content_generator: ContentGenerator::KubernetesCluster.method(:location)},
    {name: "version", type: "radio_small_cards", label: "Version", required: "required", content_generator: ContentGenerator::KubernetesCluster.method(:version)},
    {name: "cp_nodes", type: "radio_small_cards", label: "Control Plane", required: "required", content_generator: ContentGenerator::KubernetesCluster.method(:cp_nodes)},
    {name: "worker_size", type: "radio_small_cards", label: "Worker size", required: "required", content_generator: ContentGenerator::KubernetesCluster.method(:worker_size)},
    {name: "worker_nodes", type: "select", label: "Worker Nodes", required: "required", placeholder: "Select number of worker nodes", content_generator: ContentGenerator::KubernetesCluster.method(:worker_nodes), opening_tag: "<div class='sm:col-span-3'>"},
  ]

  action = "#{@project.path}/kubernetes-cluster"
%>

<%==part("components/form/resource_creation_form", action:, form_elements:, option_tree: @option_tree, option_parents: @option_parents)%>
